import HyRequest from "../index";

import { IAccount, ILoginResult, IImg } from "./type";
import { IDataType } from "../type";
// 枚举url
// 员工登录接口
enum LoginAPI {
  AccountLogin = "/employee/login",
  AccountLoginimg = "/getCodeImg"
}
export function accountLoginRequest(account: IAccount) {
  return HyRequest.post<IDataType>({
    url: LoginAPI.AccountLogin,
    method: "post",
    data: {
      id: account["name"],
      password: account["password"]
    }
  });
}
// 获取验证码
export function accountLoginImgRequest(Img: IImg) {
  return HyRequest.get({
    url: LoginAPI.AccountLoginimg,
    responseType: "arraybuffer",
    data: {
      code: Img["code"],
      key: Img["key"]
    }
  });
}
